<script language="javascript" type="text/javascript" src="/javascripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
	theme : "advanced",
	theme_advanced_buttons1 : "bold,italic,underline,bullist,numlist,link,anchor,code",
	theme_advanced_buttons2 : "",
	theme_advanced_buttons3 : "",
	mode : "textareas"
});
</script>

<% form_for(:category, :url => category_path(@category), :html => { :method => :put }) do |f| %>
	<fieldset>
		<legend>Edit "<%= @category.name %>"</legend>
		<br/>
		<%= error_messages_for :category %>
	  <p>
			<label for="name">Name</label>
			<br/>
	    <%= f.text_field :name, :class => :input_line %>
	  </p>
	  <p>
	    <label for="description">Body</label>
			<br/>
	    <%= f.text_area :body %>
	  </p>
		
		<% unless Datasheet.find(:all).empty? %>
		<p>
			<label for="datasheets">Available Datasheets (check to attach)</label>
			<% Datasheet.find(:all).each do |datasheet| %>
				<div class="datasheet">
					<%= check_box_tag "category[datasheet_ids][]", datasheet.id, @category.datasheets.include?(datasheet) %>
					<%= link_to datasheet.name, datasheet.public_filename %>
				</div>
			<% end %>
		</p>
		<% end %>
	  
		<ul class="right">
			<li class="horizontal">
				<%= link_to	"cancel", category_path(@category) %>
			</li>
			<li class="horizontal">|</li>
	    <li class="horizontal"><%= submit_tag "ok" %></li>
	  </ul>
		<br/>
	</fieldset>
<% end %>